import Vue from 'vue'
import Router from 'vue-router'
import NotFound from '@/components/NotFound'
import Login from '@/components/Login'
import Home from '@/components/Home'
import Login_form from '@/components/Login_form'
import Register from '@/components/Register'
import MyFavorite from '@/components/MyFavorite'
import MyCenter from '@/components/MyCenter'
import MyOrder from '@/components/MyOrder'
import Contact from '@/components/Contact'
import UserSet from '@/components/UserSet'
import Pay from '@/components/Pay'
import OrderDetail from '@/components/OrderDetail'
import History from '@/components/History'
import BuyCar from '@/components/BuyCar'
import Zhifu from '@/components/Zhifu'
import ShopDetail from '@/components/ShopDetail'
import sousuo from '@/components/sousuo'
import category from '@/components/category'
import AllShop from '@/components/AllShop'
import JifenShop from '@/components/JifenShop'

Vue.use(Router)

export default new Router({
    routes: [
        {
            path: '/', redirect: '/home'
        },
        {
            path: '*',
            name: 'NotFound',
            component: NotFound
        },
        // 登录
        {
            path: '/login', name: 'Login', component: Login, redirect: '/login/login_form', children: [
                { path: '/login/login_form', name: 'login_form', component: Login_form },
                { path: '/login/register', name: 'Register', component: Register }
            ], mata: {
                keepAlive: false
            }
        },
        // 首页
        {
            path: '/home', name: 'Home', component: Home
        },
        // 个人中心
        {
            path: '/center', name: 'MyCenter', component: MyCenter, children: [
                // 我的收藏
                {
                    path: '/center/favorite', name: 'MyFavorite', component: MyFavorite
                },
                // 我的订单
                {
                    path: '/center/myorder', name: 'MyOrder', component: MyOrder
                },
                // 常用联系人
                {
                    path: '/center/contact', name: 'Contact', component: Contact
                },
                // 个人设置
                {
                    path: '/center/userset', name: 'UserSet', component: UserSet
                },
                // 充值
                {
                    path: '/center/pay', name: 'Pay', component: Pay
                },
                // 订单详情
                {
                    path: '/center/orderdetail', name: 'OrderDetail', component: OrderDetail
                },
                // 浏览足迹
                {
                    path: '/center/history', name: 'History', component: History
                },
            ]
        },
        // 购物车
        {
            path: '/buycar', name: 'BuyCar', component: BuyCar
        },
        // 支付
        {
            path: '/zhifu', name: 'Zhifu', component: Zhifu
        },
        // 商品详情
        {
            path: '/shopdetail', name: 'ShopDetail', component: ShopDetail
        },
        // 搜索
        {
            path: '/search', name: 'sousuo', component: sousuo
        },
        // 分类
        {
            path: '/category', name: 'category', component: category
        },
        // 全部商品
        {
            path: '/allshop', name: 'AllShop', component: AllShop
        },
        // 积分商品
        {
            path: '/jifen', name: 'JifenShop', component: JifenShop
        }
    ],
})